package com.cedric.yixianpai.game.cards.Sects.swordCards.d_YuanYing;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class LingGanJian extends SwordCard {
    private int max=0;//加剑意上限
    /**
     * title:灵感剑
     * effect:8/12/16攻 击伤：每剩余1点灵气加1剑意（max=6/9/12）
     */
    public LingGanJian(@Value("1") int lvl) {
        super("灵感剑");
        this.setLevel(lvl);
        this.setPeriod(Period.YUANYING);
        this.setDescription("8/12/16攻 击伤：每剩余1点灵气加1剑意（最多为6/9/12）");
        if (1 == lvl) {
            this.setDamage(8);
        } else if (2 == lvl) {
            this.setDamage(12);
        } else if (3 == lvl) {
            this.setDamage(16);
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.attack(Sta2,this.getDamage());
        Sta1.getPlayerBuff().clearSwordIntent();
        int add= Math.min(this.max, Sta1.getPlayerBuff().getSpiritualEnergy());
        Sta1.getPlayerBuff().addSwordIntent(add);
        return true;
    }
}
